<?php

$rootdir = getcwd();
require_once $rootdir . '/settings/basic.php';

function count_files($dir) {

    if(defined("SCANDIR_SORT_NONE"))
        $fn = @scandir($dir, SCANDIR_SORT_NONE);
    else
        $fn = @scandir($dir);
    
    if($fn === false)
        return 0;
    else
        return count($fn) - 2;

}

?><!DOCTYPE html>
<html dir="ltr">
<head>
<meta charset="utf-8">
<!--
    Version page
    
        Author:     Alfredo Mungo
        License:    LGPL
        Copyright:  2012
-->
<title>PHI Framework</title>
<style type="text/css">
    table { border-collapse: collapse; width: 500px; font-family: courier; }
    tr { height: 24px; }
    td { border-bottom: solid black 1px; vertical-align: bottom; }
    td:first-child { min-width: 100px; font-weight: bold; }
    .indented { margin-left: 20px; }
    footer { height: 32px; bottom: 0px; font-size: 0.7em; margin: 0; padding-top: 10px; }
    header { top: 0px; margin: 0; }
    .full-bar { position: absolute; left: 0px; background-color: #6666ff; width: 100%; }
    h2:first-of-type { margin-top: 128px; }
</style>
</head>
<body>
<header class="full-bar">
    <h1>PHI Framework</h1>
</header>
<h2 class="indented">Lightweight, extensible PHP framework</h2>
<div class="indented">
    <?php if(PHI_VERSION_SHOWSTATS): ?>
        <table class="indented">
            <tr><td>Version<td><?=PHI_VERSION?>
            <tr><td>Debug<td><?= PHI_DEBUG? "Enabled": "Disabled" ?>
            <tr><td>Local Folder<td><?= PHI_ROOTDIR ?>
            <tr><td>Base URL<td><?= PHI_SERVDIR ?>
            <tr><td>Modules<td><?= count_files($rootdir . '/modules') ?>
            <tr><td>Helpers<td><?= count_files($rootdir . '/helpers') ?>
            <tr><td>Controllers<td><?= count_files($rootdir . '/applications') ?>
        </table>
    <?php endif ?>
</div>
<footer class="full-bar">
    <b>PHI Framework</b> - Copyright &copy; <?=PHI_CREDITS_COPYRIGHT_YEAR?> <?=PHI_CREDITS_COPYRIGHT_OWNER?>
</footer>
</body>
</html>
